import tester.*;

public class Examples {

	public Examples() {}

	public boolean testInsert(Tester t) {
		/*
		 * These chained inserts should result in a sorted list being stored in
		 * list1
		 */
		ILoS actual = new MtLoS().insert("Wes").insert("Boo").insert("Bar")
				.insert("Zoo");
		/* The expected result */
		ILoS expected = new ConsLoS("Bar", new ConsLoS("Boo", new ConsLoS(
				"Wes", new ConsLoS("Zoo", new MtLoS()))));
		return t.checkExpect(actual, expected);
	}

	public boolean testSort(Tester t) {
		/*
		 * The unsorted list constructed without inserts so that we force the
		 * ordering
		 */
		ILoS unsorted = new ConsLoS("Zoo", new ConsLoS("Boo", new ConsLoS(
				"Wes", new ConsLoS("Bar", new MtLoS()))));
		ILoS expectedResultOfSort = new ConsLoS("Bar", new ConsLoS("Boo", new ConsLoS("Wes",
				new ConsLoS("Zoo", new MtLoS()))));
		return t.checkExpect(unsorted.sort(), expectedResultOfSort);
	}

	public boolean testMerge(Tester t) {
		/* Create a sorted list */
		ILoS list1 = new MtLoS().insert("Apple").insert("Dog");
		/* Create another sorted list */
		ILoS list2 = new MtLoS().insert("Wes").insert("Cat");
		
		ILoS mergedList = new MtLoS().insert("Wes").insert("Cat").insert(
				"Apple").insert("Dog");
		return t.checkExpect(list1.merge(list2), mergedList);
	}

	public static void main(String[] args) {
		Tester.runFullReport(new Examples());
	}

}
